package com.lzx.applib.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.lzx.applib.utils.LogUtil;
import com.umeng.analytics.MobclickAgent;

/**
 * Created by Lzx on 16-10-30.
 */

public class UmengFragment extends Fragment {

    public final String getName() {
        return getClass().getSimpleName();
    }

    @Override
    public void onResume() {
        super.onResume();
        LogUtil.d("resume:", getName());
        MobclickAgent.onPageStart(getName());
    }

    @Override
    public void onStart() {
        super.onStart();
        LogUtil.d("start", getName());
    }

    @Override
    public void onStop() {
        super.onStop();
        LogUtil.d("stop", getName());
    }

    @Override
    public void onPause() {
        super.onPause();
        LogUtil.d("pause:", getName());
        MobclickAgent.onPageEnd(getName());
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        LogUtil.d("onActivityCreated", getName());
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        LogUtil.d("onCreate", getName());
    }

    @Override
    public void onDestroy() {
        LogUtil.d("destory", getName());
        super.onDestroy();
    }

    public void onUmengClick(String data) {
        MobclickAgent.onEvent(getActivity(), data);
    }
}
